package cn.lkk.samples.lang.classes.StaticMember;

/**
 * 本类用于演示静态成员的使用
 */
public class StaticTest {
}

class Employee {

    //1. 静态字段
    private static int nextId = 1;

    //2. 静态常量
    public static final String EMPLOYEE_CLASS_NAME = "Employee";

    private String name;
    private double salary;
    private int id;

    public Employee(String n, double s) {
        name = n;
        salary = s;
        id = 0;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public int getId() {
        return id;
    }

    public void setId(){
        id=nextId;
        nextId++;
    }


    //3. 静态方法
    public static void main(String[] args) {
        Employee e = new Employee("Harry", 5000);
        System.out.println(e.getName() + " " + e.getSalary());
    }

    //4. 静态工厂方法
}